#ifndef BMDMAINWINDOWS_H
#define BMDMAINWINDOWS_H

#include <QtGui>
#include <QSettings>
#include "feedmodel.h"

// --------------------- //
// CLASS : BMDMainWindow //
// --------------------- //
class AddFeedWidget;
class FeedTreeWidget;
class SettingsWidget;
class BMDMainWindow : public QMainWindow
{
    Q_OBJECT

public:
    //Constructor / Destructor
    BMDMainWindow(QWidget *parent = 0);
    virtual ~BMDMainWindow();

private:
    AddFeedWidget*  _addFeedWidget;
    FeedTreeWidget* _feedTreeWidget;
    SettingsWidget* _settingsWidget;

    FeedModel*      _model;
    QSettings*      _settings;
};

// --------------------- //
// CLASS : AddFeedWidget //
// --------------------- //

class AddFeedWidget : public QWidget
{
    Q_OBJECT

public:
    //Constructor
    AddFeedWidget(QWidget* parent = 0);

signals:
    //Signal with the URL of the feed to add
    void addFeed(const QUrl& feedUrl);

private slots:
    //Checks the entered URL befor sending it via the signal
    void checkEnteredUrl();

private:
    QLabel*         _feedUrlLabel;
    QLineEdit*      _feedUrlLineEdit;
    QPushButton*    _feedUrlSubmitButton;
};

// ---------------------- //
// CLASS : FeedTreeWidget //
// ---------------------- //

class FeedTreeWidget : public QWidget
{
    Q_OBJECT

public:
    //Constructor with the model of the tree
    FeedTreeWidget(FeedModel* model, QWidget* parent = 0);

private:
    QTreeView*  _feedView;
};

// ---------------------- //
// CLASS : SettingsWidget //
// ---------------------- //
class SettingsWidget : public QWidget
{
    Q_OBJECT

public:
    //Constructor with the model of the tree
    SettingsWidget(QSettings* settings, QWidget* parent = 0);

private slots:
    void editSettings();

private:
    QSettings*   _settings;
    QPushButton* _editSettingsButton;
};


/*
#include <QtCore>
#include <QtGui>
#include <QModelIndex>

#include "feedmodel.h"
#include "downloader.h"



class BMDMainWindow : public QMainWindow
{
    Q_OBJECT

public:
    BMDMainWindows(QWidget *parent = 0);
    virtual ~BMDMainWindows();

public slots:
    void addFeed();
    void treeItemDoubleClicked(const QModelIndex& index );
    void changeSettings();

    void save();
    void restore();

    void downloadComplete();

protected:
    QWidget* createMainTab();

private:
    QLineEdit* feedUrl;
    QPushButton* addFeedButton;
    QPushButton* settingsButton;
    QTreeView* feedView;
    QLabel* downloadingLabel;

    FeedModel* feedModel;
    Downloader* downloader;

    QSettings _settings;
};
*/

#endif // BMDMAINWINDOWS_H
